# Maintainer: Sergej Pupykin <pupykin.s+arch@gmail.com>
# Maintainer: Eli Schwartz <eschwartz@archlinux.org>

pkgname=firefox-adblock-plus
pkgver=3.17.1
pkgrel=1
_file=4125998
pkgdesc="Extension for firefox which block ads and banners"
arch=('any')
url="https://adblockplus.org/"
license=('GPL3')
checkdepends=('jq')
groups=('firefox-addons')
# https://addons.mozilla.org/en-US/firefox/addon/adblock-plus/versions/
# wget -qO- https://addons.mozilla.org/en-US/firefox/addon/adblock-plus/versions/ | grep -oP '/\d+/adblock_plus-\S+.xpi'
source=("https://addons.mozilla.org/firefox/downloads/file/${_file}/adblock-plus-${pkgver}.xpi")
noextract=("adblock-plus-$pkgver.xpi")
sha256sums=('51f9c87622733b49db198e2cb9c5cdd52d79d86625ae5435042a17b019c6ddfd')

check() {
  bsdtar xf adblock-plus-$pkgver.xpi manifest.json
  jq '.version' manifest.json | grep -E '^"'$pkgver'"$'
}

package() {
  depends=("firefox")

  _extension_id="{d10d0bf8-f5b5-c8b4-a8b2-2b9879e08c5d}"
  _extension_dest="${pkgdir}/usr/lib/firefox/browser/extensions/${_extension_id}"
  install -Dm644 "${srcdir}"/adblock-plus-${pkgver}.xpi "${_extension_dest}.xpi"
}
